
<template>
    <div class="policyResult">
        <product-title></product-title>
        <div class="wraper">
            <h3 class="search-h3 huang">
                快速搜索
            </h3>
            <div class="common-box-body result">
                <Form>
                    <Row>
                        <Col span="6">
                        <FormItem>
                            <Input placeholder="请输入业务员姓名" v-model="searchForm.name" ></Input>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <DatePicker type="daterange" placeholder="投保时间" @on-change="datachange" transfer></DatePicker>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <DatePicker type="daterange" @on-change="datachange2" transfer placeholder="承保时间"></DatePicker>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <Select v-model="searchForm.cid" filterable placeholder="选择保险公司" transfer >
                                <Option value="">全部</Option>
                                <Option v-for="(item, index) in comoptions" :value="item.cid" :key="index">{{item.shortn}}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <Select ref="orgselect" multiple filterable placeholder="请选择机构" v-model="searchForm.yun_org_mid" :transfer=true>
                                <Option value="">全部</Option>
                                <Option v-for="item in orglist" :value="item.id" :key="item.id">{{item.shortn}}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <Select v-model="searchForm.premium_type" transfer placeholder="请选择保费类型">
                                <Option value="">全部</Option>
                                <Option value="1">原保费</Option>
                                <Option value="2">价值保费</Option>
                                <Option value="3">标准保费</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <Select placeholder="请选择保单状态" v-model="searchForm.policy_status">
                                <Option value="">全部</Option>
                                <Option value="1">预收件</Option>
                                <Option value="2">承保件</Option>
                                <Option value="3">契撤件</Option>
                                <Option value="4">停效件</Option>
                                <Option value="5">失效件</Option>
                                <Option value="6">解约件</Option>
                                <Option value="7">终止件</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem>
                            <Select v-model="searchForm.rank_id" transfer placeholder='请选择职级'>
                                <Option value="0">全部</Option>
                                <Option :value="item.id" v-for="item in rankList" :key="item.id">{{item.name}}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="3">
                        <FormItem>
                            <Input placeholder="请输入保费最小值" v-model="searchForm.premium_min">
                            <span slot="append">元</span>
                            </Input>
                        </FormItem>
                        </Col>
                        <Col span="1">
                        <FormItem style="text-align:center;">
                            至
                        </FormItem>
                        </Col>
                        <Col span="2">
                        <FormItem>
                            <Input v-model="searchForm.premium_max" placeholder="保费最大值">
                            <span slot="append">元</span>
                            </Input>
                        </FormItem>
                        </Col>
                        <Col :xs="24" :sm="24" :md="24" :lg="{span:2,offset:22}">
                        <FormItem>
                            <Button class="fr" type="info" icon="ios-search" size="large" @click='search'>查询</Button>
                        </FormItem>
                        </Col>
                    </Row>
                </Form>
            </div>
            <div class="detail">
                <div class="clearfix">
                    <div class="table-theme">
                        <Table ref="currentRowTable" @on-current-change="tableCurrentChange($event)" size="large" stripe highlight-row border :columns="columns" :data="policylist" class=""></Table>
                    </div>
                </div>
            </div>
            <!-- <div :class="slidetoggle?'fixed-bottom':'fixed-bottom sidehide' ">
                <Row class="pro-pagesize">
                    <Col :md="24" :lg="12">
                    <Button type="info" :disabled="tableaction" size="large" class="fl mr10" @click="updateDetail">编辑</Button>
                    </Col>
                    <Col :md="24" :lg="12" class="tRight">
                    <Page :total="allTotal" ref='pages' :current="currentpage" show-total show-sizer :page-size="pagesize" @on-change="pageChange" @on-page-size-change="pageSizeChange" placement="top" class="page"></Page>
                    </Col>
                </Row>
            </div> -->
        </div>

    </div>
</template>
<script>
import productTitle from "../../components/productTitle";
import echarts from "echarts";
import { get_com, summary } from "../../api/parter";
import { getListByName } from "../../api/yun_org";
import { getRankList } from "../../api/rank";
import { statisticsOrg } from "../../api/policy";
export default {
    data() {
        return {
            showAddModal: false, //点击设置,弹出模态框
            closeable: false, //shif按ese按钮退出
            allTotal: 0,
            pagesize: 10,
            p: 1,
            currentpage: 1,
            tableaction: false,
            currentRow: {},
            columns: [
                {
                    title: "工号",
                    key: "job_code",
                    align: "center"
                },
                {
                    title: "业务员",
                    key: "name",
                    align: "center"
                },
                {
                    title: "机构名称",
                    key: "yun_org_name",
                    align: "center"
                },
                {
                    title: "职级",
                    key: "rank_name",
                    align: "center"
                },
                {
                    title: "保费(元)",
                    key: "premium",
                    align: "center"
                },
                {
                    title: "保费类型",
                    key: "premium_type",
                    align: "center"
                },
                {
                    title: "保单件数",
                    key: "policy_count",
                    align: "center"
                },
                {
                    title: "活动人力",
                    key: "active_man",
                    align: "center"
                }
            ],
            policylist: [],
            rankList: [],
            searchForm: {
                p: 1,
                pagesize: 10,
                name: "",
                yun_org_mid: "",
                cid: "", //供应商id
                policy_status: "", //保单状态
                insure_date_start: "", //投保开始时间
                insure_date_end: "", //投保结束时间
                underwrite_date_start: "", //承包开始时间
                underwrite_date_end: "", //承保结束时间
                premium_type: "", //保费类型
                premium_min: "", //保费最小值
                premium_max: "", //保费最大值
                rank_id: "" //职级
            },
            comoptions: [],
            orglist: []
        };
    },
    components: {
        productTitle
    },
    mounted() {
        this.getList();
        this.cominit();
        this.orglistinit();
        this.getRank();
    },
    computed: {
        slidetoggle() {
            return this.$store.state.sildeshow;
        }
    },
    methods: {
        //获取职级列表
        getRank() {
            new Promise((resolve, reject) => {
                getRankList()
                    .then(response => {
                        if (response.data.err == 0) {
                            this.rankList = response.data.data;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    })
                    .catch(error => {
                        reject(error);
                    });
            });
        },
        //时间转换
        datachange(value) {
            console.log(value);
            this.searchForm.insure_date_start = value[0];
            this.searchForm.insure_date_end = value[1];
        },
        //时间转换
        datachange2(value) {
            console.log(value);
            this.searchForm.underwrite_date_start = value[0];
            this.searchForm.underwrite_date_end = value[1];
        },
        orglistinit() {
            new Promise((resolve, reject) => {
                let _params = {
                    name: ""
                };
                getListByName(_params)
                    .then(response => {
                        console.log(response.data);
                        if (response.data.err == 0) {
                            this.orglist = response.data.data;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    })
                    .catch(error => {
                        reject(error);
                    });
            });
        },
        cominit() {
            new Promise((resolve, reject) => {
                let _params = {
                    name: ""
                };
                get_com(_params).then(response => {
                        console.log(response.data);
                        if (response.data.err == 0) {
                            this.comoptions = response.data.data;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    })
                    .catch(error => {
                        reject(error);
                    });
            });
        },
        // 页码改变
        // pageChange(page) {
        //     this.p = page;
        //     console.log(page);
        //     this.getList();
        // },
        // // 每页条数改变
        // pageSizeChange(pagesize) {
        //     this.pagesize = pagesize;
        //     console.log(pagesize);
        //     this.getList();
        // },
        // tableCurrentChange(currentRow, oldCurrentRow) {
        //     this.tableaction = false;
        //     this.currentRow = currentRow;
        //     console.log(this.currentRow);
        // },
        search() {
            // this.page = 1
            // this.searchForm.p = 1
            this.getList();
        },
        getList() {
            new Promise((resolve, reject) => {
                summary(this.searchForm)
                    .then(response => {
                        console.log(response.data, "11");
                        if (response.data.err == 0) {
                            this.policylist = response.data.data.list;
                            // this.allTotal = response.data.data.total;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    })
                    .catch(error => {
                        reject(error);
                    });
            });
        },
        updateDetail() {
            this.$router.push({
                name: "statistics_resultdetail"
            });
        }
    }
};
</script>































<style scoped>
.policyResult .all {
    text-align: right;
    padding-right: 15px;
}
.policyResult .wraper {
    padding: 0 20px 60px 20px;
}

.policyResult .search-form {
    overflow: hidden;
}

.policyResult search {
    padding-bottom: 20px;
}

.policyResult .search span {
    color: #68777c;
    font-weight: bold;
    padding-right: 18px;
}

.policyResult .search button {
    background-color: #00a8f7;
    color: #fff;
    margin-left: 8px;
}

.policyResult .top {
    margin-bottom: 20px;
    border-top: 1px dashed #cccccc;
}

.policyResult .wraper .headline {
    position: relative;
    font-size: 12px;
    color: #303134;
    font-weight: bold;
    margin: 10px 0;
    line-height: 32px;
}

.policyResult .wraper .add-agent {
    position: absolute;
    top: 0px;
    right: 30px;
    background-color: #348bf2;
    color: #fff;
}

.policyResult .iconfont {
    font-size: 14px;
}

.policyResult .red-font {
    color: #ff1f1f;
}

.policyResult .fixed-bottom {
    padding-left: 20px;
    padding-right: 20px;
    height: 80px;
    line-height: normal !important;
    position: fixed;
    left: 210px;
    right: 0;
    bottom: 0;
    z-index: 999;
    text-align: center;
    background-color: rgb(255, 255, 255);
    box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.28);
}

.policyResult .sidehide {
    left: 75px;
}

/* 表格样式 start*/

.policyResult .pro-card {
    margin-bottom: 10px;
}

.policyResult .pro-card-head {
    background-color: #e6e7eb;
    line-height: 38px;
    border: 1px solid #ddd;
}

.policyResult .pro-card-title {
    font-size: 14px;
    color: #333;
    font-weight: bold;
    padding-left: 20px;
}

.policyResult .pro-card-headr {
    padding-right: 10px;
    text-align: right;
}

.policyResult .pro-card-content {
    clear: both;
}

.policyResult .pro-paramname {
    text-align: center;
    background-color: #e6e7eb;
    font-size: 14px;
    color: #333;
    border-right: 1px solid #ddd;
}

.policyResult .pro-paramvalue {
    padding-left: 10px;
    border-right: 1px solid #ddd;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.policyResult .policyResult .pro-card-contentrow {
    line-height: 40px;
    border-left: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

/* 表格样式  end */

/* 分页 start */

.policyResult .page {
    margin: 0;
}

.policyResult .ivu-page {
    padding-bottom: 150px;
}

/* 分页 end */

.policyResult .receiptbox {
    padding: 10px;
    background-color: #edf2f6;
}

.policyResult .receiptbox .ivu-input-group-append button {
    background-color: #19be6b;
    color: #fff;
}

.policyResult .receiptbox .ivu-input-group {
    top: 0;
}

.policyResult .receiptbox-upload {
    position: relative;
}

.policyResult .receiptbox-upload-input {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    opacity: 0;
    cursor: pointer;
}

.policyResult .receiptbox .ivu-tag {
    vertical-align: middle;
}

.renewal-box {
    margin-left: -16px;
    margin-right: -16px;
    padding: 16px;
    padding-bottom: 0;
    background-color: #cfebf9;
    overflow: hidden;
}

.policyResult .renewal-pro {
    margin-left: -16px;
    margin-right: -16px;
    padding: 12px;
    height: 395px;
    overflow-y: auto;
}

.policyResult .renewal-pro-title {
    padding-left: 15px;
    height: 50px;
    line-height: 50px;
    font-size: 16px;
    background-color: #edf2f6;
    margin-bottom: 10px;
}

.policyResult .renewal-pro-title b {
    display: inline-block;
    margin-left: 20px;
}

.policyResult .renewal-pro-checkbox {
    font-size: 14px;
    padding-left: 15px;
    border: 1px solid #edf2f6;
    height: 50px;
    line-height: 50px;
    margin-bottom: 10px;
}

.policyResult .renewal-pro-price {
    color: #ff4848;
    font-size: 16px;
    padding-right: 15px;
}

.policyResult .renewal-footer {
    margin: -12px -18px;
    padding: 12px 18px;
    background-color: #f2f2f2;
    overflow: hidden;
}

.policyResult .renewal-footer-l {
    float: left;
}

.renewal-footer-r {
    float: right;
}

.policyResult .renewal-total {
    padding-left: 15px;
    color: #ff3d3d;
    font-size: 25px;
}

.policyResult .mod_table {
    margin-right: 22px;
    margin-top: 20px;
    height: 50px;
}
</style>
<style>
.policyResult .a-link {
    color: #4074e1;
    text-decoration: underline;
    cursor: pointer;
}

.policyResult .ivu-table-row-highlight .a-link {
    color: #fff;
}

.policyResult .receiptbox .ivu-tag span.ivu-tag-text {
    max-width: 260px;
    overflow: hidden !important;
    display: inline-block;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.policyResult .receiptbox .ivu-tag span.ivu-tag-dot-inner,
.policyResult .receiptbox .ivu-tag i {
    vertical-align: middle;
}
.policyResult .modal .ivu-date-picker-rel:after,
.policyResult .modal .ivu-select:after {
    height: 32px;
}
</style>

